/*
 * @Title: 票选优品溯源图文详情
 * @Author: Jcuiweif
 * @Date:   2018-12-19
 * @Last Modified by:   Jcuiweif
 * @Last Modified time: 2018-12-19
 */
$(document).ready(function(){
    var t = $(document).width()/10;
    $("html").css("font-size",t);})
var dataInfo = {},
  template = {
    init: function() {
      Vue.use(VueLazyload, {
        preLoad: 1.3,
        error: 'https://h5.meetao.com/img/product/init.png',
        loading: 'https://h5.meetao.com/img/product/init.png',
        attempt: 1
      });
      dataInfo.init = new Vue({
        el: '#app',
        data: {
          width: document.body.offsetWidth,
          tabData: [],
          swiperData: [],
          votebannerdown:[],
          versions: versions,
          icon: {
            normal: '../img/index/shouhui.png',
            active: '../img/index/shouhong.png',
            normal1: '../img/index/gouhui.png',
            active1: '../img/index/gouhong.png',
            active2: '../img/index/myhong.png',
            normal2: '../img/index/myhui.png',
            active3: '../img/index/pthong.png',
            normal3: '../img/index/pthui.png',
            downicon:"../img/voteGoods/down_icon.png",
            up_icon:"../img/voteGoods/up_icon.png",
          },
          playicon:'../img/playVideo.png',
          active: 0,
          activeindex:1,
          all: false, //loadOver - show
          isFx: 1,
          isDz: 0,
          page: 1,
          choose:0,
          limit: 10,
          loading1: 'https://h5.meetao.com/img/product/init.png',//whtiteeyes.png
          eyes:'../img/voteGoods/eyes.png',
          whtiteeyes:'../img/voteGoods/whtiteeyes.png',
          loading: false,
          isLoading: false,
          finished: false,
          listData: [], //商品集合
          coverImgUrl:'',
          sourceAuthor:'',
          videoDescUrl:'',
          textdetail:{},
          sourceTitle:'',
          sonPage:[],
          sonLimit:[],
          sonLimit1:3,
          reback:[],
          contentinput:'',
          placeholder :'我也说两句',
          type:0,
          authorId:'',
          referenceId:'',
          referenceUserId:'',
          getid:'',
          loadtext:'已加载全部',
          showOffarr:[],
          arrson:[],
          isApp:0,
        },
        computed:{
          reversedMessage: function(){
            for (var i = 0; i < dataInfo.init.reback.length; i++) {//子评论对应评论数
              dataInfo.init.sonPage[i] = Math.ceil(dataInfo.init.reback[i].children.length/3);
            }
            console.log(dataInfo.init.sonPage)
            return;
          }
        },
        methods: {
          toProduct: function(data) { //toProduct
            jumpProductDetails(data);
          },
          getSource: function() {
              var app = decodeURIComponent(getQueryString('isApp'));
              dataInfo.init.$set(dataInfo.init,'isApp',app);
              if(app == 1){
                // if (location.href.indexOf('&')>-1){
                    var href = decodeURI(location.href);
                    var title = href.split('&')[1].split('=')[1];
                    // shareInfo.title  = decodeURI(title);
                    dataInfo.init.$set(dataInfo.init,'sourceTitle',title);
                //   }
                    ajaxTemplate(addressTest + SERVICE.sourceinfo, function(data) {
                      if (data.tag == 0) {
                          var result = data.data.result;
                          console.log('theme',data)
                          dataInfo.init.$set(dataInfo.init,'textdetail',result);
                          // shareInfo.imgUrl = result.coverImgUrl;
                      } else {
                          dataInfo.init.$toast(data.errMsg);
                      };
                      }, {
                          sourceCode:decodeURIComponent(getQueryString('sourceCode')),
                      });
              }
            
          },
        },
      });
      dataInfo.init.getSource();
    //   dataInfo.init.getTab();
    }
  };
template.init();

